package com.example.chapter5.pojo;

import com.example.chapter5.converter.SexConverter;
import com.example.chapter5.enumeration.SexEnum;
import org.apache.ibatis.type.Alias;

import javax.persistence.*;



// 标明是一个实体类
@Entity(name = "user")
// 定义映射的表
@Table(name = "t_user")

//这里只是加入了加粗的注解＠Alias ， 并且指定它的别名为“ user ”。
// mybatis
@Alias(value = "user")
public class User {
    // 标明主键
    @Id
    // 主键策略，递增
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id = null;
    // 定义属性和表的映射关系
    @Column(name = "user_name")
    private String userName = null;

//    @Convert(converter = SexConverter.class)  //jpa

    private SexEnum sex = null;
    private String note = null;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public SexEnum getSex() {
        return sex;
    }

    public void setSex(SexEnum sex) {
        this.sex = sex;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }
}
